# coding:utf-8
import re
from PyQt6.QtCore import Qt, QEasingCurve, QUrl
from PyQt6.QtGui import QPixmap
from PyQt6.QtWidgets import QWidget, QVBoxLayout
from qfluentwidgets import (SingleDirectionScrollArea, SmoothScrollArea, ToolTipFilter, PixmapLabel,
                            ScrollArea, ImageLabel, HorizontalPipsPager, PipsScrollButtonDisplayMode, VerticalPipsPager)
from qframelesswindow.webengine import FramelessWebEngineView

from views.template_chat_view import BaseInfoTemplateView

from .base_gallery_view import GalleryInterface
from .common.translator import Translator


class StockMonitorView(BaseInfoTemplateView):
    """ Scroll interface """

    def __init__(self,   parent=None):
        t = Translator()
        super().__init__(
            "stockMonitorView",
            parent=parent
        )

        # 添加一个报表
        self.addEcahtMainView("base_chat_demo")

    def doSearch(self):
        AntLogger.info(f"查询股票{self.searchKey}")
        self.updateEchatData()

    def getEchatData(self, jsonData: dict):
        source_data = [
            ["月份", "M-5", "M-4", "M-3", "M-2", "M-1", "M", "M+1"],
            ["国盛金控", 56.5, 82.1, 88.7, 70.1, 53.4, 85.1, 41.2],
            ["风华高科", 51.1, 51.4, 55.1, 53.3, 73.8, 68.7, 41.2],
            ["海信家电", 40.1, 62.2, 69.5, 36.4, 45.2, 32.5, 41.2],
            ["永辉超市", 25.2, 37.1, 41.2, 18, 33.9, 49.1, 41.2]
        ]

        jsonData['dataset']['source'] = source_data
        return jsonData
